package w2

import scala.collection.mutable.ArrayBuffer

object YieldTest {
  def main(args: Array[String]): Unit = {
    var arr = Array(11, 42, 8, 41, 25, 16, 47, 8, 9)

    val s = for (a <- arr if a % 2 == 1) yield a
    println(s.toBuffer)

    var k = new ArrayBuffer[Int]()
    for (a <- arr if a % 2 == 1)
      k += a

    println(k.toBuffer)


    arr = arr.sortWith(_ > _)

    println(arr.toBuffer)
  }
}
